<table class="base-info-table" width="100%" id="general-table" align="center">
	<tbody>
		<tr>
		<td class="label">商品名称：</td>
		<td>
			<input type="text" class="qs-input" name="goods_name" value="{$goods.goods_name}" style="float:left;color:;" size="30">
			<br/>
		</tr>
		<tr>
			<td class="label">
				<a href="javascript:showNotice('noticeGoodsSN');" title="点击此处查看提示信息">
					<img src="__PUBLIC__/image/admin/notice.gif" width="16" height="16" border="0" alt="点击此处查看提示信息">
				</a>商品货号：
			</td>
			<td>
				<input id="goods_sn" type="text" class="qs-input" name="goods_sn" value="{$goods.goods_sn}" size="20" onblur="checkGoodsSn(this.value,'{$goods.goods_id}')">
				<span>
					<input type="button" class="qs-btn" value="系统生成" onclick="auto_create({$goods.goods_id});">
				</span>				
				<span id="goods_sn_notice"></span>
				<br>
				<span class="notice-span" style="" id="noticeGoodsSN">如果您不输入商品货号，系统将自动生成一个唯一的货号。</span>
			</td>
		</tr>
		<tr>
			<td class="label">商品分类：</td>
			<td>
			<select class="qs-select" name="cat_id" onchange="hideCatDiv()">
				<option value="0">请选择...</option>				
				<volist name="goodsCatList" id="goodsCat">
					<if condition="$goodsCat['cat_id'] eq $goods['cat_id']">
						<option value="{$goodsCat.cat_id}" selected="selected">{$goodsCat.cat_name}</option>
					<else/>
						<option value="{$goodsCat.cat_id}">{$goodsCat.cat_name}</option>
					</if>					
				</volist>
			</select>
			<span id="category_add" style="display:none;">
			<input class="text" size="10" name="addedCategoryName">
			<a href="javascript:void(0)" onclick="addCategory()" title=" 确定 " class="qs-btn"> 确定 </a>
			<a href="javascript:void(0)" onclick="return goCatPage()" title="分类管理" class="special">分类管理</a>
			<a href="javascript:void(0)" onclick="hideCatDiv()" title="隐藏" class="special">&lt;&lt;</a>
			</span>
			<span class="require-field">*</span>            
			</td>
		</tr>
		<tr>
			<td class="label">扩展分类：</td>
			<td>
			<input type="button" class="qs-btn" value="添加" onclick="addOtherCat(this.parentNode)" >
			</td>
		</tr>
		<tr>
			<td class="label">商品品牌：</td>
			<td>
				<select class="qs-select" name="brand_id" onchange="hideBrandDiv()">
					<option value="0">请选择...</option>
					<volist name="brand_list" id="brand">
						<if condition="$key eq $goods['brand_id']">
							<option value="{$key}" selected="selected">{$brand}</option>
						<else/>
							<option value="{$key}">{$brand}</option>
						</if>
					</volist>
				</select>
			</td>
		</tr>
		<tr>
			<td class="label">选择供货商：</td>
			<td>
				<select class="qs-select" name="suppliers_id" id="suppliers_id">
					<option value="0" >不指定供货商属于本店商品</option>
					<volist name="suppliers_list_name" id="supplier">
						<if condition="$key eq $goods['suppliers_id']">
							<option value="{$key}" selected="selected">{$supplier}</option>
						<else/>
							<option value="{$key}">{$supplier}</option>
						</if>
					</volist>   
				</select>
			</td>
		</tr>
		<tr>
			<td class="label">本店售价：</td>
			<td>
				<input type="text" class="qs-input" name="shop_price" value="{$goods.shop_price}" size="20" onblur="priceSetted()">
				<input type="button" class="qs-btn" value="按市场价计算" onclick="marketPriceSetted()">
				<span class="require-field">*</span>
			</td>
		</tr>
		<tr>
			<td class="label" height="60">
				<a href="javascript:showNotice('noticeUserPrice');" title="点击此处查看提示信息">
					<img src="__PUBLIC__/image/admin/notice.gif" width="16" height="16" border="0" alt="点击此处查看提示信息">
				</a>会员价格：
			</td>
			<td>
				<if condition="$user_rank_list">
					<volist name="user_rank_list" id="user_rank">
						{$user_rank.rank_name}
						<span id="nrank_{$user_rank.rank_id}"></span>
						<input type="text" id="rank_{$user_rank.rank_id}" name="user_price[]" value="{$member_price_list[$user_rank['rank_id']]|default="-1"}" onkeyup="if(parseInt(this.value)<-1){this.value='-1';};set_price_note({$user_rank.rank_id})" size="8" />
						<input type="hidden" name="user_rank[]" value="{$user_rank.rank_id}" />
					</volist>					
				</if>
				<br>
				<span class="notice-span" style="display:block" id="noticeUserPrice">会员价格为-1时表示会员价格按会员等级折扣率计算。你也可以为每个等级指定一个固定价格</span>
			</td>
		</tr>
		<tr>
			<td class="label" height="60px">
				<a href="javascript:showNotice('volumePrice');" title="点击此处查看提示信息">
				<img src="__PUBLIC__/image/admin/notice.gif" width="16" height="16" border="0" alt="点击此处查看提示信息"></a>商品优惠价格：
			</td>
			<td>
				<table width="100%" id="tbody-volume" align="center">
					<!--
					<tr>
						<td>
							<a href="javascript:;" onclick="addVolumePrice(this)">[+]</a>
							优惠数量 <input type="text" name="volume_number[]" size="8" value="{$volume_price.number}"/>
							优惠价格 <input type="text" name="volume_price[]" size="8" value="{$volume_price.price}"/>
						</td>
					</tr>
					-->
					<volist name="volume_price_list" id="volume_price" key="number">
						<tr>
							<td>
								<if condition="$number eq 1">
									<a href="javascript:;" onclick="addVolumePrice(this)">[+]</a>
								<else/>
									<a href="javascript:;" onclick="removeVolumePrice(this)">[-]</a>
								</if>
								优惠数量 <input type="text" name="volume_number[]" size="8" value="{$volume_price.number}"/>
								优惠价格 <input type="text" name="volume_price[]" size="8" value="{$volume_price.price}"/>
							</td>
						</tr>
					</volist>
				</table>
				<span class="notice-span" style="display:block;height:25px;line-height:25px;" id="volumePrice">购买数量达到优惠数量时享受的优惠价格</span>
			</td>
		</tr>
		<tr>
			<td class="label">市场售价：</td>
			<td>
				<input type="text" class="qs-input" name="market_price" value="{$goods.market_price}" size="20">
				<input type="button" class="qs-btn" value="取整数" onclick="integral_market_price()">
			</td>
		</tr>
		<tr>
			<td class="label">
				<a href="javascript:showNotice('giveIntegral');" title="点击此处查看提示信息">
					<img src="__PUBLIC__/image/admin/notice.gif" width="16" height="16" border="0" alt="点击此处查看提示信息">
				</a> 
				赠送消费积分数：
			</td>
			<td>
				<input type="text" class="qs-input" name="give_integral" value="{$goods.give_integral}" size="20">
				<br>
				<span class="notice-span" style="display:block" id="giveIntegral">购买该商品时赠送消费积分数,-1表示按商品价格赠送</span>
			</td>
		</tr>
		<tr>
			<td class="label">
				<a href="javascript:showNotice('rankIntegral');" title="点击此处查看提示信息">
					<img src="__PUBLIC__/image/admin/notice.gif" width="16" height="16" border="0" alt="点击此处查看提示信息">
				</a> 赠送等级积分数：
			</td>
			<td>
				<input type="text" class="qs-input" name="rank_integral" value="{$goods.rank_integral}" size="20">
				<br>
				<span class="notice-span" style="display:block" id="rankIntegral">购买该商品时赠送等级积分数,-1表示按商品价格赠送</span>
			</td>
		</tr>
		<tr>
			<td class="label">
				<a href="javascript:showNotice('noticPoints');" title="点击此处查看提示信息">
				<img src="__PUBLIC__/image/admin/notice.gif" width="16" height="16" border="0" alt="点击此处查看提示信息"></a> 积分购买金额：
			</td>
			<td>
				<input type="text" class="qs-input" name="integral" value="{$goods.integral}" size="20" onblur="parseint_integral()" ;="">
				<br>
				<span class="notice-span" style="display:block" id="noticPoints">(此处需填写金额)购买该商品时最多可以使用积分的金额</span>
			</td>
		</tr>
		<tr>
			<td class="label">
				<label for="is_promote">
					<input type="checkbox" id="is_promote" name="is_promote" value="1" <if condition="$goods['promote_price']">checked="checked"</if> onclick="handlePromote(this.checked);"> 促销价：
				</label>
			</td>
			<td id="promote_3">
				<input type="text" class="qs-input qs-input-disabled" id="promote_1" name="promote_price" value="{$goods.promote_price}" size="20" disabled="">
			</td>
		</tr>
		<tr id="promote_4">
			<td class="label" id="promote_5">促销日期：</td>
			<td id="promote_6">
				<input name="promote_start_date" class="qs-input" type="text" id="promote_start_date" size="12" value="{$goods.promote_start_date}" readonly="readonly">
				 - <input name="promote_end_date" class="qs-input" type="text" id="promote_end_date" size="12" value="{$goods.promote_end_date}" readonly="readonly">
			</td>
		</tr>
		<tr>
			<td class="label">上传商品图片：</td>
			<td>
				<input type="file" name="goods_img" size="35">
				<if condition="$goods['goods_img']">
					<div class="fr" style="width:100px;cursor:pointer;" alt="点击查看大图" src="__UPLOAD__/images/{$goods['goods_img']}" onclick="alert('大图在此');">
						<img src="__UPLOAD__/images/{$goods.goods_thumb}" width="60px" height="60px"/>
					</div>
				</if>
				<br/>
				<input type="text" size="40" class="qs-input" value="商品图片外部URL" style="color:#aaa;" onfocus="if (this.value == '商品图片外部URL'){this.value='http://';this.style.color='#000';}" name="goods_img_url">
				<br/>
				<span class="notice-span" style="color:red;padding:5px 0px;" id="noticeGoodsSN">商品图片的大小为700 * 700px</span>
			</td>
		</tr>
		<tr id="auto_thumb_1">
			<td class="label"> 上传商品缩略图：</td>
			<td id="auto_thumb_3">
				<input type="file" name="goods_thumb" size="35" disabled="">
				<img src="__PUBLIC__/image/admin/no.gif">
				<br>
				<input type="text" size="40" class="qs-input qs-input-disabled" value="商品缩略图外部URL" style="color:#aaa;" onfocus="if (this.value == '商品缩略图外部URL'){this.value='http://';this.style.color='#000';}" name="goods_thumb_url" disabled="">
				<br>
				<label for="auto_thumb">
				<input type="checkbox" id="auto_thumb" name="auto_thumb" checked="true" value="1" onclick="handleAutoThumb(this.checked)">自动生成商品缩略图
				</label>            
			</td>
		</tr>
	</tbody>
</table>
<script>
	$(function() {
		$( "#promote_start_date" ).datepicker({dateFormat: 'yy-mm-dd'});
		$( "#promote_end_date" ).datepicker({dateFormat: 'yy-mm-dd'});
	});
	/*系统分配goods_sn*/
	function auto_create(goods_id){
		$.ajax({
			url:'__URL__/auto_create',
			type:'post',
			dataType:'json',
			data:{goods_id:goods_id},
			beforeSend:function(){
				$('#loading').QLoading({text:'',status:'open',modal:false});
			},
			success:function(msg){
				if(parseInt(msg.data) == 0){
					$('#loading').QLoading({text:msg.info,img:'sad',status:'close',time:1.5});
				}
				else{
					$('#goods_sn').attr('value',msg.info);
					$('#loading').QLoading({text:'',img:'happy',status:'close',time:1.5});
				}
			},
			error:function(){}
		});
	}
</script>
 
